﻿using Common.Communal;
using MediatR;
using Sell.Api.Write.Application.Command.SupplierCommand;
using Sell.Services.Suppliers;

namespace Sell.Api.Write.Application.CommandHandlers.SupplierCommandHandlers
{
    public class SupplierDelCommandcsHandlers : IRequestHandler<SupplierDelCommand, ApiResult<int>>
    {
        public ISupplierServices supplier { get; }
        public SupplierDelCommandcsHandlers(ISupplierServices _supplier)
        {
            supplier = _supplier;
        }
        /// <summary>
        /// 供应商管理删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<ApiResult<int>> Handle(SupplierDelCommand request, CancellationToken cancellationToken)
        {
            return await supplier.DeleteSupplier(request.Id);
        }
    }
}
